import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import Vuex from 'vuex'
import ElementUI from 'element-ui'
// 引入全局样式表
import './assets/css/global.css'
// 按需引入element-ui及样式
import './plugins/element.js'
import 'element-ui/lib/theme-chalk/index.css'
// 引入阿里图标库样式文件
import './assets/iconfont/iconfont.css'
// 引入jQuery
// import $ from 'jquery'
// 引入boostrap样式
// import 'bootstrap/dist/css/bootstrap.min.css'
// import 'bootstrap/dist/js/bootstrap.min'

// 引入markdown编辑器
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
Vue.use(mavonEditor)

// 解决elementui弹出对话框页面抖动问题
ElementUI.Dialog.props.lockScroll.default = false
Vue.use(ElementUI)

Vue.prototype.$http = axios
axios.defaults.baseURL = 'http://localhost:3000/api/'
// axios拦截器加入token,如若不加入token值，则后台无法返回相应数据
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

axios.interceptors.response.use(config => {
  return config
})

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    inputContent: '',
    screenWidth: document.documentElement.clientWidth
  },
  mutations: {
  }
})
Vue.config.productionTip = false

new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')
